<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Login Page</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="format-detection" content="telephone=no">
    <meta name="renderer" content="webkit">
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <link rel="alternate icon" type="image/png" href="{{ asset('admin/assets/i/favicon.png') }}">
    <link rel="stylesheet" href="{{ asset('admin/amazeui.min.css') }}"/>
    <style>
        .header {
            text-align: center;
        }
        .header h1 {
            font-size: 200%;
            color: #333;
            margin-top: 30px;
        }
        .header p {
            font-size: 14px;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="am-g">
        <h1>lcz</h1>
    </div>
    <hr />
</div>
<div class="am-g">
    <div class="am-u-lg-4 am-u-md-8 am-u-sm-centered">
        <form method="post" class="am-form" id='myform' onsubmit="return sub();">

            <label for="email">账号:</label>
            <input type="text" name="name" id="name" value="" required>
            <br>
            <label for="password">密码:</label>
            <input type="password" name="password" id="password" value="" required>
            <br>
            <label for="remember-me">
                <input id="remember-me" name="remember" type="checkbox" value="0">
                记住密码
            </label>
            <br />
            <div class="am-cf">
                <input type="submit" name="" value="登 录" class="am-btn am-btn-primary am-btn-sm am-fl">
            </div>
        </form>
        <hr>
        <p>© 2014 AllMobilize, Inc. Licensed under MIT license.</p>
    </div>
</div>
<script type="text/javascript" src="{{ asset('admin/lib/jquery-3.0.0/jquery-3.0.0.min.js') }}"></script>
<script type="text/javascript" src="{{ asset('admin/lib/layer/layer.js') }}"></script>
<script type="text/javascript">

    function sub(){
        var formobj = document.getElementById('myform');
        var data = new FormData(formobj);
        $.ajax({
            type: 'POST',
            url: "{{ URL::to('admin/auth/loginPost') }}",
            data: data,
            dataType: 'json',
            processData: false,
            contentType: false,
            headers: {
                'X-CSRF-TOKEN': " {{ csrf_token() }}"
            },
            success: function(ret){
                if(ret.code == 1){
                    layer.msg(ret.msg,{icon:1,time:1000},function(){
                        document.location.href="{{ URL::to('admin/') }}";
                    });
                }else{
                    layer.msg(ret.msg,{icon:1,time:1000,shift: -30});
                }
            },
            error: function(xhr, type){

            }
        });

        return false;
    }
</script>
</body>
</html>
